import server from '@/utils/https.ts'
import type { UserInfo } from '@/types/user'
import type { QRCodeVO, TokenVO, UnifyResponse, UserVO } from '@/types/result'

export const getQRCodeAPI = async (data: UserInfo): Promise<UnifyResponse<QRCodeVO>> => {
  const response = await server.post('/api/user/qrcode', data)
  return response.data
}

export const postLoginAPI = async (data: UserInfo): Promise<UnifyResponse<TokenVO>> => {
  const response = await server.post('/api/user/login', data)
  return response.data
}

export const postUserVOAPI = async (): Promise<UnifyResponse<UserVO>> => {
  const response = await server.post('/api/user', {})
  return response.data
}
